package designMode.proxyPattern.protect;

import java.lang.reflect.Proxy;

/**
 * @author LIBOFEI
 * @ClassName Test
 * @description
 * @date 2020/7/1 13:51
 * @Version 1.0
 **/
public class Test  {

    public static void main(String[] args) {

        PersonBean personBean = new PersonBeanImpl();

        Object o = Proxy.newProxyInstance(
                personBean.getClass().getClassLoader(),
                personBean.getClass().getInterfaces(),
                new OwnerInvocationHandler(personBean));

        PersonBean obj = (PersonBean)o;
        System.out.println(obj.getGender());
        obj.setHotOrNotRating(1);
    }
}
